#include "SemanticNodeEnum.h"


SemanticNodeEnum::SemanticNodeEnum(const SyntaxTreeNode& syntaxNode, SemanticNode *parentNode) : SemanticNode(parent) {
	LexicUnit lu = CompilerData->Units->GetLexicUnit(syntaxNode.Nodes->GetData(1)->LexUnitID);
	name = CompilerData->Units->GetLexicUnitString(&lu);
	names = flattenTemplateIdentifiers(*syntaxNode.Nodes->GetData(3));
	//TODO pogledat da li postoje duplicirana imena
}


std::string SemanticNodeEnum::toDebugString(int tab) {
	std::ostringstream ss;
	for (int i = 0; i < tab; i++) ss << DEBUG_STRING_RAZMAK;
	ss << "enum " << name << " { ";
	for (std::vector<std::string>::iterator i = names.begin(); i != names.end(); ++i)
		ss << *i << " ";
	ss << "}" << std::endl;
	return ss.str();
}
